package com.objectcarpentry.kaylee.ui.handlers;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;

import com.objectcarpentry.kaylee.IPlayer;
import com.objectcarpentry.kaylee.State;
import com.objectcarpentry.kaylee.gstreamer.KayleeGStreamerPlugin;

public class PauseHandler extends AbstractHandler {

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		IPlayer player = KayleeGStreamerPlugin.getDefault().getPlayer();
		switch (player.getState()){
		case PAUSED : 
			player.play();
			break;
		case PLAYING : 
			player.pause();
			break;
		}
		return null;
	}

}
